import Cookies from 'js-cookie'

import store from '@/store'
const TokenKey = 'Admin-Token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
export function changeRoles(router) {
  store.state.permission.routers = null

  store.state.tagsView.visitedViews = []
  // const defaultPage = localStorage.getItem('默认页')
  // const pageName = defaultPage.split('-')[0]
  console.info(router)
  router.push({ name: localStorage.默认页 })
}
